package name.matthewgreet.example3.action; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.InterceptorRef; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import com.opensymphony.xwork2.ActionSupport; import name.matthewgreet.example3.action.ViewCountryListAction.CountryListByFirstCharFinder; import name.matthewgreet.example3.common.AbstractFormDrivenActionSupport; import name.matthewgreet.example3.common.BrowserTabSession; import name.matthewgreet.example3.common.ListCache; import name.matthewgreet.example3.form.FindCountryByFirstCharForm; import name.matthewgreet.example3.vo.CountryDTO; /** * Finds countries by first character of name. */ @InterceptorRef("FormDrivenStack") @Results({ @Result(name=ActionSupport.INPUT, type="redirectAction", params = {"namespace", "/", "actionName", "ViewCountryList"}), @Result(name=ActionSupport.SUCCESS, type="redirectAction", params = {"namespace", "/", "actionName", "ViewCountryList"}) }) public class FindCountryListByFirstCharAction extends AbstractFormDrivenActionSupport<FindCountryByFirstCharForm> { private static final long serialVersionUID = -7979376337555804889L; @Action("/FindCountryListByFirstChar") @Override public String execute() throws Exception { BrowserTabSession session; ListCache<Integer,CountryDTO> listCache; session = getBrowserTabSession(); listCache = ViewCountryListAction.retrieveListCache(session); listCache.setListFinder(new CountryListByFirstCharFinder(session, getModel().getParsedFirstChar())); return SUCCESS; } @Override protected FindCountryByFirstCharForm makeForm() { return new FindCountryByFirstCharForm(); } }